//
//  UIBarButtonItem+Extension.swift
//  SinaMicroBlog
//
//  Created by wxy on 15/9/12.
//  Copyright © 2015年 wxy. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    
    convenience init(imageName: String,target: AnyObject?, actionName: String?) {
        
        let button = UIButton(imageName: imageName)
        
        // 监听方法
        if target != nil && actionName != nil {
            
            button.addTarget(target, action: Selector(actionName!), forControlEvents: .TouchUpInside)
        }
        
        self.init(customView: button)
    }
}
